package com.jcl.cloud.services.crawler.brain.config;



import javax.validation.constraints.NotNull;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

@Component
/*@ConfigurationProperties(
        prefix = "jcl.crawlers"
)*/
public class CrawlerGrabProperties {
    @NotNull
    private int grabCoreSize = 10;
    @NotNull
    private int grabMaxSize = 20;
    @NotNull
    private int grabQueueSize = 100;
    private static final long ONE_DAY_SEC = 86400L;
    @NotNull
    private long keepAliveTime = 86400L;
    @NotNull
    private long grabNoTaskSleepSeconds = 5L;
    @NotNull
    private int grabHungrySize = 50;
    @NotNull
    private int MaxProcessTaskNum = 50;
    private int MaxWaitingTask = 25;

    public CrawlerGrabProperties() {
    }

    public int getGrabCoreSize() {
        return this.grabCoreSize;
    }

    public int getGrabMaxSize() {
        return this.grabMaxSize;
    }

    public int getGrabQueueSize() {
        return this.grabQueueSize;
    }

    public long getKeepAliveTime() {
        return this.keepAliveTime;
    }

    public long getGrabNoTaskSleepSeconds() {
        return this.grabNoTaskSleepSeconds;
    }

    public int getGrabHungrySize() {
        return this.grabHungrySize;
    }

    public int getMaxProcessTaskNum() {
        return this.MaxProcessTaskNum;
    }

    public int getMaxWaitingTask() {
        return this.MaxWaitingTask;
    }

    public void setGrabCoreSize(int grabCoreSize) {
        this.grabCoreSize = grabCoreSize;
    }

    public void setGrabMaxSize(int grabMaxSize) {
        this.grabMaxSize = grabMaxSize;
    }

    public void setGrabQueueSize(int grabQueueSize) {
        this.grabQueueSize = grabQueueSize;
    }

    public void setKeepAliveTime(long keepAliveTime) {
        this.keepAliveTime = keepAliveTime;
    }

    public void setGrabNoTaskSleepSeconds(long grabNoTaskSleepSeconds) {
        this.grabNoTaskSleepSeconds = grabNoTaskSleepSeconds;
    }

    public void setGrabHungrySize(int grabHungrySize) {
        this.grabHungrySize = grabHungrySize;
    }

    public void setMaxProcessTaskNum(int MaxProcessTaskNum) {
        this.MaxProcessTaskNum = MaxProcessTaskNum;
    }

    public void setMaxWaitingTask(int MaxWaitingTask) {
        this.MaxWaitingTask = MaxWaitingTask;
    }

    public boolean equals(Object o) {
        if (o == this) {
            return true;
        } else if (!(o instanceof CrawlerGrabProperties)) {
            return false;
        } else {
            CrawlerGrabProperties other = (CrawlerGrabProperties)o;
            if (!other.canEqual(this)) {
                return false;
            } else if (this.getGrabCoreSize() != other.getGrabCoreSize()) {
                return false;
            } else if (this.getGrabMaxSize() != other.getGrabMaxSize()) {
                return false;
            } else if (this.getGrabQueueSize() != other.getGrabQueueSize()) {
                return false;
            } else if (this.getKeepAliveTime() != other.getKeepAliveTime()) {
                return false;
            } else if (this.getGrabNoTaskSleepSeconds() != other.getGrabNoTaskSleepSeconds()) {
                return false;
            } else if (this.getGrabHungrySize() != other.getGrabHungrySize()) {
                return false;
            } else if (this.getMaxProcessTaskNum() != other.getMaxProcessTaskNum()) {
                return false;
            } else {
                return this.getMaxWaitingTask() == other.getMaxWaitingTask();
            }
        }
    }

    protected boolean canEqual(Object other) {
        return other instanceof CrawlerGrabProperties;
    }

    public int hashCode() {
        int result = 1;
        result = result * 59 + this.getGrabCoreSize();
        result = result * 59 + this.getGrabMaxSize();
        result = result * 59 + this.getGrabQueueSize();
        long keepAliveTime = this.getKeepAliveTime();
        result = result * 59 + (int)(keepAliveTime >>> 32 ^ keepAliveTime);
        long grabNoTaskSleepSeconds = this.getGrabNoTaskSleepSeconds();
        result = result * 59 + (int)(grabNoTaskSleepSeconds >>> 32 ^ grabNoTaskSleepSeconds);
        result = result * 59 + this.getGrabHungrySize();
        result = result * 59 + this.getMaxProcessTaskNum();
        result = result * 59 + this.getMaxWaitingTask();
        return result;
    }

    public String toString() {
        return "CrawlerGrabProperties(grabCoreSize=" + this.getGrabCoreSize() + ", grabMaxSize=" + this.getGrabMaxSize() + ", grabQueueSize=" + this.getGrabQueueSize() + ", keepAliveTime=" + this.getKeepAliveTime() + ", grabNoTaskSleepSeconds=" + this.getGrabNoTaskSleepSeconds() + ", grabHungrySize=" + this.getGrabHungrySize() + ", MaxProcessTaskNum=" + this.getMaxProcessTaskNum() + ", MaxWaitingTask=" + this.getMaxWaitingTask() + ")";
    }
}
